/**
 * @file   CommunicationMode.h
 * @author Djuro Drljaca (djurodrljaca@gmail.com)
 * @date   2014-04-21
 * @brief  DON communication mode enum and it's supporting functions.
 *
 * Copyright 2014  Djuro Drljaca (djurodrljaca@gmail.com)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef DON_CORE_NODE_COMMUNICATIONMODE_H
#define DON_CORE_NODE_COMMUNICATIONMODE_H

#include <QtCore/qglobal.h>
#include <DON/Core/libdon-qt4-core_global.h>

namespace DON
{
namespace Core
{
namespace Node
{

/**
 * @brief Enumerates all communication modes
 */
enum CommunicationMode
{
    CommunicationMode_Invalid = -1,
    CommunicationMode_Receiver = 0,
    CommunicationMode_Transmitter = 1,
    CommunicationMode_Transceiver = 2
};

/**
 * @brief Check if communication mode is valid
 * @param communicationMode Communication mode
 * @retval true Communication mode is valid
 * @retval false Communication mode is not valid
 */
LIBDONQT4CORESHARED_EXPORT bool isCommunicationModeValid(const CommunicationMode communicationMode);

/**
 * @brief Convert binary data to CommunicationMode value
 * @param data Binary data
 * @param ok Error status output (true --> success, false --> error)
 * @return CommunicationMode value
 */
LIBDONQT4CORESHARED_EXPORT CommunicationMode fromBinaryToCommunicationMode(const char data);

/**
 * @brief Convert CommunicationMode value to binary data
 * @param communicationMode CommunicationMode value
 * @param ok Error status output (true --> success, false --> error)
 * @return Binary data
 */
LIBDONQT4CORESHARED_EXPORT char fromCommunicationModeToBinary(
        const CommunicationMode communicationMode, bool *ok = NULL);

}
}
}

#endif // DON_CORE_NODE_COMMUNICATIONMODE_H
